<template>
	<view>
		<!-- <webviewVue :src="src"></webviewVue> -->
		<web-view  :src="src" @message="onMessage"></web-view>
	</view>
</template>

<script>
	// import webviewVue from '../../components/webview.vue';
	export default {
		name:"webview",
		components: {
			// webviewVue
		},
		data() {
			return {
				src: ''
			};
		},
		onLoad(options) {
			console.log('options.isEdit', options.isEdit)
			// let host = 'http://localhost:4000/headimg'
			let host = 'https://shop.hercter.com/headimg'
			// this.src = 'https://shop.hercter.com/headimg/?search=' + options.q + '&t=' + new Date().getTime()
			if(options.isEdit == 1){
				if(options.process == 7 || options.process == 8) {
					this.src = host + '/?isEdit=1&id=' + options.id +  + '&token=' + this.$store.state.app.token + '&t=' + new Date().getTime()
				}
				if(options.process == 9 || options.process == 10) {
					this.src = host + '/keyChain?isEdit=1&id=' + options.id +  + '&token=' + this.$store.state.app.token + '&t=' + new Date().getTime()
				}
				// this.src = 'https://shop.hercter.com/headimg/?isEdit=1&id=' + options.id +  + '&token=' + this.$store.state.app.token + '&t=' + new Date().getTime()
			}
			else{
				if(options.process == 7 || options.process == 8) {
					this.src = host + '/?search=' + options.q + '&t=' + new Date().getTime()
				}
				
				if(options.process == 9 || options.process == 10) {
					this.src = host + '/keyChain?search=' + options.q + '&t=' + new Date().getTime()
				}
				
				if(options.process == 12) {
					this.src = host + '/acrylicStandingSign?search=' + options.q + '&t=' + new Date().getTime()
				}
				if(options.process == 12) {
					this.src = 'http://localhost:4000/headimg/acrylicStandingSign?search=' + options.q + '&t=' + new Date().getTime()
				}
				
				// this.src = 'https://shop.hercter.com/headimg/?search=' + options.q + '&t=' + new Date().getTime()
			}
			
			// this.src = 'http://127.0.0.1:5500'
			console.log('this.src', this.src)
		},
		methods: {
			onMessage(e) {
				console.log('收到消息1')
				console.log('收到消息:', e); // 关键！必须取 data[0]
				
				console.log('收到消息')
			}
		}
	}
</script>

<style>

</style>